{% extends "docker_engine/base.html" %}


{% load staticfiles %}

{% block extra-css %}
<link rel="stylesheet" type="text/css" href="{% static 'docker_engine/assets/fancybox/source/jquery.fancybox.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'docker_engine/assets/uniform/css/uniform.default.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'docker_engine/assets/chosen-bootstrap/chosen/chosen.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'docker_engine/assets/bootstrap/css/bootstrap-fileupload.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'docker_engine/css/application/new.css' %}" />
{% endblock %}


{% block content %}
<div id="page" class="dashboard">
    <!-- BEGIN SAMPLE FORM PORTLET-->   
    <div class="widget">
        <div class="widget-title">
            <h4><i class="icon-reorder"></i> New Application</h4>
        </div>
        <div class="widget-body form">
            <!-- BEGIN FORM-->
            <form action="/docker/application/update/" method="post" class="form-horizontal">
                {% csrf_token %}
                <div class="control-group">
                    <label class="control-label" for="application_name">Application Name</label>
                    <div class="controls">
                        <input type="text" class="span6" name="application_name" value="{{ application.name }}" readonly="true" />
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">Definition File</label>
                    <div class="controls">
                        <textarea class="span6" rows="10" name="definition_file" readonly="true">{{ definition_file }}</textarea>
                    </div>
                </div>

                <hr />

                <div class="control-group">
                    <label class="control-label"><b>Resource Requirement</b></label>
                </div>

                <div class="control-group">
                    <label class="control-label" for="cpu_limit">CPU Limit</label>
                    <div class="controls">
                        <div class="input-prepend input-append">
                            <input type="text" name="cpu_limit" value="{{ application.cpu_limit  }}" /><span class="add-on">Cores</span>
                        </div>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="memory_limit">Memory Limit</label>
                    <div class="controls">
                        <div class="input-prepend input-append">
                            <input type="text" name="memory_limit" value="{{ application.memory_limit }}" /><span class="add-on">GB</span>
                        </div>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="io_read_limit">I/O Read Limit</label>
                    <div class="controls">
                        <div class="input-prepend input-append">
                            <input type="text" name="io_read_limit" value="{{ application.io_read_limit }}" /><span class="add-on">MB/s</span>
                        </div>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="io_write_limit">I/O Write Limit</label>
                    <div class="controls">
                        <div class="input-prepend input-append">
                            <input type="text" name="io_write_limit" value="{{ application.io_write_limit }}" /><span class="add-on">MB/s</span>
                        </div>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="net_send_limit">Network Send Limit</label>
                    <div class="controls">
                        <div class="input-prepend input-append">
                            <input type="text" name="net_send_limit" value="{{ application.net_send_limit }}" /><span class="add-on">MB/s</span>
                        </div>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label" for="net_receive_limit">Network Receive Limit</label>
                    <div class="controls">
                        <div class="input-prepend input-append">
                            <input type="text" name="net_receive_limit" value="{{ application.net_receive_limit }}" /><span class="add-on">MB/s</span>
                        </div>
                    </div>
                </div>

                <div class="form-actions">
                    <a href="{% url 'application_create' %}"><button type="submit" class="btn btn-primary">Update</button></a>
                    <a href="{% url 'application_index' %}"><button type="button" class="btn">Cancel</button></a>
                </div>
            </form>
            <!-- END FORM-->             
        </div>
    </div>
    <!-- END SAMPLE FORM PORTLET-->
</div>
{% endblock %}


{% block extra-js %}
<script src="{% static 'docker_engine/assets/chosen-bootstrap/chosen/chosen.jquery.min.js' %}"></script>
<script src="{% static 'docker_engine/assets/uniform/jquery.uniform.min.js' %}"></script>
<script src="{% static 'docker_engine/assets/fancybox/source/jquery.fancybox.pack.js' %}"></script>
<script src="{% static 'docker_engine/assets/bootstrap/js/bootstrap-fileupload.js' %}"></script>
<script src="{% static 'docker_engine/js/application/all.js' %}"></script>
<script src="{% static 'docker_engine/js/application/detail.js' %}"></script>
{% endblock %}